<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/10/3
  Time: 11:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="js/jquery-1.8.3.js"></script>
<html>
  <head>
    <title>个人简历信息列表</title>
    <style>
      #box{
        margin: 0 auto;
        width: 700px;
      }
      #box h1{
        text-align: center;
      }
      #table tr td{
        width: 80px;
        height: 30px;
      }
    </style>
  </head>
  <body>
  <div id="box">
    <h1>个人简历信息列表</h1>
    <div>
      <form action="list" method="get">
        性别：
        <input type="radio" name="sex" ${sex == "男" ? "checked" : ""} value="男"> 男
        <input type="radio" name="sex" ${sex == "女" ? "checked" : ""} value="女"> 女
        <input type="radio" name="sex" ${sex == "" ? "checked" : ""} value=""> 全部

        <input type="submit" value="查询">

        <input type="button" onclick="toAdd()" value="新增个人简历信息">
      </form>
    </div>
    <table id="table" border="1px solid black">
      <tr>
        <td>姓名</td>
        <td>性别</td>
        <td>籍贯地址</td>
        <td>出生日期</td>
        <td>联系电话</td>
        <td>毕业学校</td>
        <td>简历状态</td>
        <td>操作</td>
      </tr>
      <c:forEach var="list" items="${list}">
        <tr>
          <td>${list.userName}</td>
          <td>${list.sex}</td>
          <td>${list.address}</td>
          <td>${list.birth}</td>
          <td>${list.telephone}</td>
          <td>${list.school}</td>
          <td>${list.status==1?"公开":"保密"}</td>
          <td><a href="#" onclick="dele(${list.id})">删除</a></td>
        </tr>
      </c:forEach>
    </table>
  </div>
  </body>
<script>
  $(function (){
    $("#table tr:odd").css("background","#d4efef")
    $("#table tr:even").css("background","#d4e2ef")
  })
  function toAdd(){
    location.href="add.jsp"
  }
  function dele(id){
    var c = confirm("确定要删除吗？");
    if(c){
      $.getJSON("delete","id="+id,function (data) {
        if (data.result>0){
          alert("删除成功");
          location.reload();
        }else {
          alert("删除失败");
        }
      })
    }
  }
</script>
</html>
